const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

async function checkSchema() {
  try {
    // 检查用户数据
    const user = await prisma.user.findUnique({ 
      where: { username: 'admin' }, 
      include: { secrets: true } 
    });
    console.log('找到用户:', user ? 'Yes' : 'No');
    if (user) {
      console.log('用户ID:', user.id);
      console.log('邮箱:', user.email);
      console.log('密钥信息:', user.secrets ? 'Yes' : 'No');
    }
    
    // 获取数据表结构信息
    const databaseInfo = await prisma.$queryRaw`SHOW TABLES`;
    console.log('数据库表:', databaseInfo);
    
    const secretsColumns = await prisma.$queryRaw`DESCRIBE Secrets`;
    console.log('Secrets表结构:', secretsColumns);
  } catch (error) {
    console.error('错误:', error);
  } finally {
    await prisma.$disconnect();
  }
}

checkSchema(); 